home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1996 November / macformat-043.iso / mac / Shareware Plus / Developers / OpenStack Rinaldi Collection / openstack-rinaldi-lib / Textoid 4.5 (US) / Textoid 4.5 (US).rsrc / HELP_5635 next >
Encoding:
Text File  |  1996-01-08  |  20.4 KB  |  376 lines

  1.  
  2.  
  3.                                               Textoid 4.5
  4.  
  5.                                           by Frédéric RINALDI
  6.  
  7.  
  8. CAUTION: mouse message (clickInText), and returned parameters order (clicked word is now the third parameter, no more the second one) have changed since version 4.2. Don't forget to modify your script accordingly.
  9.  
  10.  
  11. DESCRIPTION
  12.   Textoid XCMD displays a full-styled text windoid.
  13.  
  14. SYNTAX
  15.        Textoid <WName>[,<text>[,<WStyle>][,<color>] [,<X,Y[,Z,T]>]
  16.                    [,<textWrap>][,<FName>] [,<FSize>] [,<FStyle>] [,<FAlign>] ]
  17.  
  18. PARAMETERS
  19.    Only first param is needed. Order of params 3 to 10 doesn't matter, since the XCMD is able to recognize them.
  20.  
  21.    <WName> is a string giving the windoid name. Many windoids can be opened by using different names.
  22.  
  23.    <Text> is the text that will be displayed in the windoid. It can be litteral or a field descriptor.
  24.  
  25.       Textoid "Test","This is my text"
  26.       Textoid "Test",cd fld 1
  27.  
  28.    If you pass a valid field descriptor enclosed in quotes, HyperCard will not interpret it and Textoid will use the full-styled text of that field rather than its text only. If the descriptor is not valid, Textoid will use it as litteral.
  29.  
  30.       Textoid "Test","cd fld 1"
  31.  
  32.    If you want to use the field name, you will use :
  33.  
  34.       Textoid "Test","cd fld" && quote & "Name" & quote
  35.  
  36.    New
  37.    If you pass a TEXT/styl resource name from current stack, Textoid will use them as window content. This new feature also allows you to save (by using set ResExport of window <wind> to <resName>) and restore (by using set text of window <wind> to <resName>) full colored text.
  38.  
  39.    <WStyle> is a string defining the window style. Allowed styles are : plain, zoom, roundRect, rect, shadow, windoid, windoidZoom, bigWindoid, bigWindoidZoom, Rinaldoid, RinaldoidZoom (Rinaldoid is the same as windoid, except that it displays the window title). All window styles are floating, except plain, zoom and roundRect. A windoid or Rinaldoid style window will have small scrollbars, while other styles will use standard size. Default is RinaldoidZoom if Rinaldoid WDEF resource is present, windoidZoom if not found.
  40.  
  41.    <Color> is a one or two items string giving the foreground and background color. For each item, allowed values are the standard colors (black, white, blue, red, yellow, cyan, magenta, green), or a three word string corresponding to red, green and blue values (100 5624 28652).
  42.  
  43.    <X,Y[,Z,T]> will be a point or a rect, and will define position and/or size of the windoid. Coordinated are card-relative. If omitted, windoid will appear with standard size at "0,10".
  44.  
  45.    <textWrap> is a boolean to wrap (true) or not (false) the text in the windoid. This param makes also the horizontal scrollBar be invisible (true) or visible (false). Default is true, and horizontal scroll being hidden.
  46.  
  47.    <FName> is a string giving the font that will be used. Default is Geneva.
  48.  
  49.    <FSize> is a string giving the font size that will be used. Default is 9.
  50.  
  51.    <FStyle> is an item(s) string giving the font style(s) that will be used (plain, bold, italic, outline, underline, shadow, condense, extend, grouped). Default is Plain.
  52.  
  53.    <FAlign> is a string giving the text alignment that will be used (left,right, center). Default is left.
  54.  
  55.    Using "!", "?" or "=" as first parameter will return an online help (resp. copyright, syntax and output).
  56.  
  57. USING
  58.    Textoid is stand alone, no linked resource is needed. Meanwhile, this stack contains a WDEF resource that are recognized by the XCMD if present. The WDEF allows to have an enhanced windoid-type window displaying title. So, this resources is optional, and for aesthetic purpose only. If you copy it, its ID can be set to any value but don't change its name. Each window can contain up to 32000 chars.
  59.  
  60. Hint: 
  61.   If you use a rect or shadow style window, placing it on a card can simulate a smart double-scroll HyperCard field.
  62.  
  63.    With multiple screens configuration, the windoid will be zoomed on the screen that it lays on.
  64.  
  65.   Textoid offers full text editing with Cut, Copy, Paste and Erase. lockText property allows to lock/unlock the content. When a window is created, its text is locked. Like for a field, the content must be locked to accept mouseDown events (thus HyperText). If unlocked, the insertion point will be set at the clickLoc.
  66.  
  67. Shortcuts: 
  68.    • Control-Clic in text allows to move the window
  69.    • Command-Click in text locks/unlocks the text (only if UnLockAllowed 
  70. property is true).
  71.    • Option-Clic in text allows to move text with grabber hand
  72.    • Holding ShiftKey makes any scrolling smoother.
  73.    • Holding OptionKey while clicking in a scrollBar reverses the scroll
  74.    • Command-A selects the whole text (if unlocked)
  75.    • Control-Option-P, B, I, U, O, S, C, E, G changes selection style
  76.  
  77.    SelectedChunk property allows to select any part of the text. When using set selectedChunk of window "MyWindow" to "X,Y", the window is brought to the front, the text is automatically unlocked, scrolled to show the insertion point, and you are ready to type in it. You can also get the selectedChunk when the window is closed using :
  78.  
  79.     on closeTextoid Which
  80.       get selectedChunk of window Which
  81.       put char (item 1 of it) to (item 2 of it) of Text¬
  82.       of window Which
  83.     end closeTextoid
  84.  
  85.    In order to allow text manipulation by clicking on an HC button, Textoid keep the last selection in a global variable TextoidLastSelection :
  86.         "<first char>,<last char>,<window name>,<window ID>"
  87.    Following script will chage current selection to bold :
  88.  
  89.     on mouseUp
  90.       global TextoidLastSelection
  91.       put item 3 of TextoidLastSelection into WName
  92.       set selectedChunk of window WName to ¬            
  93.       item 1 to 2 of TextoidLastSelection
  94.       set textStyle of window WName to "bold"
  95.     end mouseUp
  96.  
  97. Hint:
  98.    the insertion point will be placed at the end of the text by using :
  99.    set selectedChunk of window MyWindow to 32000
  100.  
  101.    When a Textoid is displayed, font, style, size and even color are accessible using the existing menus. These act exactly like for HyperCard fields : if there is no current selection in the windoid, menus change the global window attributes. Otherwise, only the current selection attributes are changed.
  102.  
  103.   FieldTransfer property (set only) allows to transfer the full-styled text from the windoid to any existing field. Field descriptor must be enclosed in quotes, like the input parameter.
  104.  
  105.    set fieldTransfer of window "Test" to "cd fld 1"
  106.  
  107.    Both scrollBars can now be hidden. In this case, the growBox remains hidden, but is stilll active.
  108.  
  109.      on openTextoid WName,WId
  110.        if WName is "MyWindow"
  111.        then
  112.          set textWrap of window WName to true
  113.          set ShowVScroll of window WName to false
  114.        end if
  115.      end openTextoid
  116.  
  117.    The window content can now be printed by using :
  118.      send "print" to window "MyWindow"
  119.  
  120.  
  121. MESSAGES
  122.    OpenTextoid : sent when a windoid is opened, followed by the windoid name and ID. This allows to define window properties before it is shown, since the message can be trapped using a handler :
  123.  
  124.      on openTextoid WName,WId
  125.        if WName is "MyWindow" then...
  126.      end openTextoid
  127.  
  128.    CloseTextoid : sent when a windoid is closed, followed by the windoid name and ID. This allows to define window properties before it is shown, since the message can be trapped using a handler :
  129.  
  130.      on closeTextoid WName,WId
  131.        if WName is "MyWindow" then...
  132.      end closeTextoid
  133.  
  134.  
  135.    ActivateTextoid : sent for non-floating windows only (plain, zoom, roundRect), when the window is activated. It is followed by the windoid name and ID.
  136.  
  137.    DeActivateTextoid : sent for non-floating windows only (plain, zoom, roundRect), when the window is de-activated. It is followed by the windoid name and ID.
  138.  
  139.    mouseDownInTextoid, mouseUpInTextoid, DblClickInTextoid : 
  140.    sent when clicking on a word in the locked window, followed by the windoid name and ID, clicked word, start and end char being clicked, font, size, style and color of text.
  141.    mouseUpInTextoid is sent only if mouse button is released on the same word that generated the mouseDownInTextoid message.
  142.  
  143.    If the whole sent string (message + params) exceeds 255 chars, then the clicked string will consist of its first 254 chars, followed by character "..." to signify the overflow (the ellipsis character, not three dot characters, hex C9).
  144.  
  145. on DblClickInTextoid WName,WId,Word,Start,Stop,Font,¬
  146.                      Size,Style,Color
  147.   if WName is "Test1" and Wrd is ...
  148. end DblClickInTextoid
  149.  
  150. Note:
  151.    Font, Size, Style and Color may contain many items if the clicked text has different text attributes.
  152.  
  153. PROPERTIES
  154.    Like any XWindow, Textoid has properties that can be get and set thru HyperTalk. Default values are shown underlined.
  155.   properties of window "Textoid" will return an item list of all allowed properties :
  156.    • loc             : windoid's position according to card (X,Y)
  157.    • globalLoc   : windoid's position according to screen (X,Y)
  158.    • visible       : windoid's visibility (true or false)
  159.    • id              : windoid's id (get only)
  160.    • messages  : list of messages sent by the windoid
  161.    • text          : windoid's text (quoted field descriptor gives full style)
  162.    • rect          : windoid's position and size according to card (X,Y,Z,T)
  163.    • globalRect : windoid's position and size according to screen (X,Y,Z,T)
  164.    • textFont    : current selection's or windoid's font (geneva, times, …)
  165.    • textSize    : current selection's or windoid's font size (9, 10,…)
  166.    • textAlign  : windoid's text alignment (left,right,center)
  167.    • textStyle  : current selection's or windoid's text style (plain,italic,
  168.                          bold,outline,underline,shadow,condense,extend,grouped)
  169.    • hScroll      : horizontal scroll value (X pixels)
  170.    • vScroll      : vertical scroll value (X pixels)
  171.    • zoom         : zoomed state (in, out)
  172.    • textColor  : current selection or windoid's text color (black, white,
  173.                          blue, red, yellow, cyan, magenta, green)  or (R G B)
  174.    • backColor : back color (black, white, blue, red, yellow, cyan, magenta,
  175.                          green)  or (R G B)
  176.    • lockText          : text locking (true or false)
  177.    • viewChunk       : visible text portion (Start[,Stop])
  178.    • selectedChunk  : current selection offset (Start,Stop)
  179.    • selectedText    : current selection text (set allows to replace selected 
  180.       text in the window by another text)
  181.    • fieldTransfer   : text transfer to any field (set only)
  182.    • textWrap         : wrapping of text (true or false)
  183.    • textWidth        : width of text (set has no effect if textWrap = true)
  184.    • UnLockAllowed : unlocking text by Cmd-click permission (true or false)
  185.    • GrowAllowed   : window growing permission (true or false)
  186.    • MoveAllowed   : window moving permission (true or false)
  187.    • ShowVScroll    : vertical scrollBar visible (true or false)
  188.    • ShowHScroll    : horizontal scrollBar visible (= NOT textWrap)
  189.    • ResExport        : text export as TEXT/styl ressources  (set only)
  190.  
  191. ERRORS
  192.    If an error occurs, external can return :
  193.      "Error : Missing window name"
  194.      "Error : Text cannot exceed 32000 chars"
  195.      "Error : Unrecognized parameter"
  196.      "Error : Duplicate window name"
  197.      "Error : Empty parameter"
  198.      "Error : Window rect defined twice"
  199.      "Error : Window loc defined twice"
  200.      "Error : Text wrap defined twice"
  201.      "Error : Font size defined twice"
  202.      "Error : Font name defined twice"
  203.      "Error : Font style defined twice"
  204.      "Error : Font alignment defined twice"
  205.      "Error : Bad text style"
  206.      "Error : Unable to create XWindow"
  207.      "Error : XWindows not implemented"
  208.      "Error : Bad property value"
  209.      "Error : Resource export failed"
  210.  
  211. HISTORY
  212. 4.5                                                                                         12/14/94
  213. • Fixed <textWrap> param bug
  214.  
  215. 4.4                                                                                         12/02/94
  216. • Fixed an old style menu bug
  217.  
  218. 4.3                                                                                         05/17/94
  219. • Remplaced clickInText message by mouseDownInTextoid, mouseUpInTextoid and DblClickInTextoid
  220. • Changed returned parameters order for those messages (clicked word is now param #3)
  221.  
  222. 4.2                                                                                         04/09/94
  223. • Fixed again <text> param parser. Now bullet-proof.
  224.  
  225. 4.1                                                                                         02/14/94
  226. • Fixed <text> param parser.
  227.  
  228. 4.0                                                                                         05/03/93
  229. • Cleared a 44 bytes forgotten block
  230. • Fixed ResExport bug when selection was not empty
  231.  
  232. 3.9                                                                                         01/22/93
  233. • Fixed rare memory bug
  234. • Fixed scroll bug when selection is passed the last char
  235.                                                                                          
  236. 3.8                                                                                         12/04/92
  237. • TEXT/styl resources can now be read from any accessible resource file
  238. • viewChunk and selectedChunk now display the selection at the text's top
  239.                                                                                          
  240. 3.7                                                                                         10/28/92
  241. • Added TEXT/styl resources import/export
  242. • Rinaldoid WDEF System 7-like
  243. • Small ScrollBars System 7-like
  244.                                                                                          
  245. 3.6                                                                                         07/08/92
  246. • Added printing feature
  247. • Added extended keyboard function keys support
  248. • Text color is not lost anymore when setting the text property
  249.                                                                                          
  250. 3.5                                                                                         05/21/92
  251. • Added owner property
  252.                                                                                          
  253. 3.4                                                                                         05/05/91
  254. • Fixed "set rect" property
  255.                                                                                          
  256. 3.3                                                                                         04/21/91
  257. • Fixed bug appearing with Classic/System 6
  258. • Enhanced property error handling
  259. • Changed SetClickLoop
  260.                                                                                          
  261. 3.2                                                                                         03/12/92
  262. • No more CURS resources creation in res file
  263. • Last selection stored in TextoidLastSelection global variable
  264. • Added ActivateTextoid and DeActivateTextoid messages
  265. • HyperText uses Script Mgr to get word boundaries
  266. • Fixed default window position
  267. • Grouped style now supported
  268. • Fixed edition in non-floating windows
  269. • ScrollBars are updated while click-dragging in text
  270. • Non-floating windows no more hidden when switching feom HC
  271. • Added window ID param with all messages
  272. • Added id, messages, UnLockAllowed,GrowAllowed, MoveAllowed, ShowVScroll, ShowHScroll  and viewChunk properties
  273. • Horizontal scrollBars visible only if needed (textWrap = false)
  274. • Both scrollbars can now be hidden
  275. • Fixed many other small bugs
  276.                                                                                          
  277. 3.1                                                                                         05/25/91
  278. • fixed set textSize bug
  279.                                                                                          
  280. 3.0                                                                                         04/24/91
  281. • Full Undo now supported
  282. • All text attributes properties now apply to current selection if one
  283. • Added text grabbing with option-click in text
  284. • Holding shift key while using a scrollBar inverses the scrolling direction
  285. • Holding option key while using a scrollBar gives smooth scrolling
  286. • Command-click now also unlocks the text
  287. • Insertion caret placed in text as soon as unlocked, no more second click 
  288.    needed
  289. • Scrolls are now hidden for non-floating backmost windows
  290. • ForeColor property renamed TextColor
  291. • ClicInText message renamed ClickInText
  292. • selectedText property renamed selectedChunk
  293. • Added selectedText property to get selection's text
  294. • Added style shortcuts (Ctrl-Option P, B, I, U, O, S, C, E)
  295. • Added Alignment items in style menu
  296. • Text Color is passed along with ClicInText message, as well as different 
  297.    text attributes if there are.
  298. • Default scroll is now fast, slow optional
  299. • Fixed Font and Style menu handling bug
  300. • Window rect calculation tuned to match field rect calculation
  301. • Fixed scroll bar update when end of text is deleted
  302. • Fixed wrapping when text changed from an existing field
  303. • Fixed non-floating window re-activation
  304.                                                                                          
  305. 2.2
  306. • Text Font, Size and Style are passed along with ClicInText message.
  307.                                                                                          
  308. 2.1
  309. • Clicked word font, size and style are now passed along with clicInText
  310.                                                                                          
  311. 2.1
  312. • Textoid supports now full styled text !
  313. • Added fieldTransfer, textWidth and textWrap properties
  314. • Added fore and background color menu items
  315. • Fixed unwanted autoscroll with HyperText
  316. • Wrap property not changed anymore when resizing window
  317. • Default text width is now 3000 for non-wrapping text
  318. • Clipboard is correctly transfered while switching
  319. • Fixed last null char of text bug
  320.                                                                                          
  321. 2.0
  322. • enhanced window show/hide handling while switching under MultiFinder
  323. • selection restored when activating non-floating windows
  324. • text font, size and style can now be set using menus
  325. • window ordering now correct when zooming in/out
  326. • fixed random bug coming from bad controlHandle
  327. • window clipboard now transferred only if not empty
  328. • fixed hypertext bug when clicking on last word
  329. • idle sent to card window even while editing windoid's text
  330. • added start and stop char passed along with ClicInText message
  331.                                                                                          
  332. 1.9
  333. • changed inContent cursor
  334.                                                                                          
  335. 1.8
  336. • Added window style parameter
  337. • Added "openTextoid" message
  338. • Fixed rect/globalRect property to not show window if invisible
  339. • Added support of Rinaldoid WDEF and CDEF
  340.                                                                                          
  341. 1.6
  342. • Window title is displayed
  343. • All RBG values available for color
  344. • Added "closeTextoid" message when closing window
  345. • Fixed minor bugs
  346. • Added "selectedText" property
  347. • Added command-A shortcut
  348.                                                                                          
  349. 1.5
  350. • full text editing added.
  351.                                                                                          
  352. 1.4
  353. • fixed a bug arising on CPUs with no Color QuickDraw
  354.                                                                                          
  355. 1.3
  356. • Added color support
  357.                                                                                          
  358. 1.2
  359. • fixed word hilighting with wrapping word
  360.                                                                                          
  361. 1.1
  362. • fixed visual minor bugs (color GrowBox, multi-screen grow frame)
  363. • added hyperText capabilities
  364. • added properties : globalLoc,globalRect,textAlign,textStyle,hScroll,
  365.    vScroll,zoom
  366.                                                                                          
  367.   This stack also uses Switch & FullHpop XFCNs, © Frédéric RINALDI 1989…1993.
  368. --------------------------------------------------------------------
  369.    All externals included in this stack are FreeWare and may be used in non-commercial software provided the following notice is visibly present :
  370.  
  371.                    Textoid XCMD, © Frederic Rinaldi, 1989…1994.
  372.  
  373.    Free for non-commercial use. Use in commercial software subjected to prior acknowledgement and licensing from the author, reachable at the following network addresses:
  374.  
  375. AppleLink: RINALDI1   CalvaCom : FR10    Compuserve : 71170,2111
  376.                Internet : RINALDI1@APPLELINK.APPLE.COM